<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    <%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
    <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>

<script type="text/javascript" src="../js/jquery-1.10.2.js"></script>
<script type="text/javascript">

$(document).ready(function(){

	var sb1 = document.getElementById("sb_num").value;
	document.getElementById("sb_num2").value = sb1;
});
function replyCheck(){
	if($('#sb_re_content').val()==''){
		alert("댓글을 입력해주세요.");
		$('#sb_re_content').focus();
		return false;
	}
}
</script>

<form name="myForm1">
<table width="600" border="0" cellspacing="0" cellpadding="0" align="center">
<img src="../images/111.jpg">
	<table border="0" align="center">
	<tr>
		<td><h2>${shopboard.sb_title}</h2></td>
	</tr>
	</table>
	
	<table width="500" border="0" align="center">
	<tr>
		<td colspan="2">
		<hr size="1"width="100%" noshade>
		</td>
	</tr>
		
	<tr>
		<td><h3>${shopboard.sb_content}</h3></td>
	</tr>
	<tr>
		<td colspan="2">
		<hr size="1"width="100%" noshade>
		</td>
	</tr> 
	</table> 
	<table width="500" border="0" align="center">
	<tr>
    <td><input type="hidden" id="sb_num" value="${shopboard.sb_num}"/>글 번호:${shopboard.sb_num}</td>
	</tr>
	
	<tr>	
		<td>작성자ID:${shopboard.m_id}</td>
	</tr>	
	<tr>
		<td>조회수:${shopboard.sb_count}</td>
	</tr>
	<tr>
		<td>등록날짜:${shopboard.sb_today}</td>
	</tr>
	</table>
	<table align="center">
	<tr>
		<td align="right" colspan="2">
	<c:if test="${shopboard.m_id == userId}">
			<input type="button" value="수정" 
				onclick="location.href='boardupdate.do?sb_num=${shopboard.sb_num}'">
		<input type="button" value="삭제" 
				onclick="location.href='boarddelete.do?sb_num=${shopboard.sb_num}'">
	</c:if>
			<input type="button" value="목록" onclick="location.href='boardlist.do'">
		</table>
			<table width="1000" border="0" cellspacing="2" cellpadding="1" >
			<br>
 	<tr bgcolor="#F3F3F3">
 		<td width="50">번호</td>
 		<td width="50">ID</td>
 		<td width="850">내용</td>
 		<td width="100">날짜</td>   
 <form name="myForm2" action="boardreplywrite.do" method="post" onsubmit="return replyCheck()">
<c:if test= "${userId != null }">
	<input type="hidden" id="sb_num2" name="sb_num"/>
	<input type="hidden" name="m_id" id="m_id" value="${userId }">
	댓글내용:<input type="text" id="sb_re_content" name="sb_re_content" size="70"/>
	<input type="submit" value="등록"/>
</c:if>
</form>
 	</tr>
 	<c:forEach var="reply" items="${replylist}">
 		<tr>
 			<td>${reply.sb_re_num}</td>
 			<td>${reply.m_id}</td>
 			<td>${reply.sb_re_content }</td>
 			<td>${reply.sb_re_date}<td>
 	 		</tr>
 	</c:forEach>
</table>
		</td>
		
	</tr>
	</table>    
	<tr>
	<td height="10"></td>
</tr> 
	</table>
	

</form>


 
